﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucForum.ascx.cs" Inherits="WCrawler.Controls.ucForum" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="~/Controls/ucFilterForum.ascx" TagName="ucFilterForum" TagPrefix="UserControl" %>
<style type="text/css">
    .BackgroundStyle
    {
        background-color: #f3f3f3;
        filter: alpha(opacity=50);
        opacity: 0.5;
    }
    
    a:link, a:visited
    {
        color: #034af3;
    }
    
    .style5
    {
        width: 156px;
    }
    .style8
    {
        width: 152px;
    }
    .style9
    {
        width: 419px;
    }
    .style10
    {
        width: 123px;
    }
    .style11
    {
        width: 133px;
    }
    .style12
    {
        width: 150px;
    }
</style>
<asp:Panel ID="pnlCommand" runat="server">
    <asp:Button ID="btnAddNewForum" runat="server" OnClick="btnAddNewForum_Click" Text="New Forums" />
    <asp:Button ID="btnCheckInfos" runat="server" OnClick="btnCheckInfos_Click" Text="Check Infos" />
    <asp:Button ID="btnApprove" runat="server" OnClick="btnApprove_Click" Text="Approve" />
    <asp:Button ID="btnFormatUrl" runat="server" OnClick="btnFormatUrl_Click" Text="Format Url" />
    <asp:Label ID="Label9" runat="server" Text="Select Group"></asp:Label>
    <asp:DropDownList ID="dropDownListChangeGroup" runat="server" DataSourceID="GroupLinqDataSource"
        DataTextField="GroupName" DataValueField="GroupId" Style="margin-bottom: 0px">
    </asp:DropDownList>
    <asp:Button ID="btnChangeGroup" runat="server" OnClick="btnChangeGroup_Click" Text="Change Group" />
    <asp:Label ID="lblWCrawlerSettings" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="btnRunService" runat="server" OnClick="btnRunService_Click" Text="Run Service" />
</asp:Panel>
<asp:Panel ID="pnlSearch" runat="server">
    <table style="border-style: ridge; border-width: thin; width: 100%;">
        <tr>
            <td class="style10" align="right">
                <asp:Label ID="Label11" runat="server" Text="Url"></asp:Label>
            </td>
            <td class="style9">
                <asp:TextBox ID="txtSearchUrl" runat="server" Width="100%"></asp:TextBox>
            </td>
            <td align="right" class="style5">
                <asp:Label ID="Label6" runat="server" Text="Group"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="GroupDropDownList" runat="server" AppendDataBoundItems="True"
                    DataSourceID="GroupLinqDataSource" DataTextField="GroupName" DataValueField="GroupId"
                    Width="100%">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style10" align="right">
                <asp:Label ID="Label2" runat="server" Text="Location"></asp:Label>
            </td>
            <td class="style9">
                <asp:DropDownList ID="LocationDropDownList" runat="server" DataSourceID="LocationLinqDataSource"
                    DataTextField="LocationName" DataValueField="LocationId" AppendDataBoundItems="True"
                    Height="23px" Width="100%">
                </asp:DropDownList>
            </td>
            <td align="right" class="style5">
                <asp:Label ID="Label7" runat="server" Text="Login Status"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="LoginStatusDropDownList" runat="server" AppendDataBoundItems="True"
                    Width="100%">
                    <asp:ListItem Value="1">Succesful</asp:ListItem>
                    <asp:ListItem Value="0">Invalid</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style10" align="right">
                <asp:Label ID="Label3" runat="server" Text="Type"></asp:Label>
            </td>
            <td class="style9">
                <asp:DropDownList ID="ForumTypeDropDownList" runat="server" DataSourceID="ForumTypeLinqDataSource"
                    DataTextField="TypeName" DataValueField="ForumTypeId" AppendDataBoundItems="True"
                    Width="100%">
                </asp:DropDownList>
            </td>
            <td align="right" class="style5">
                <asp:Label ID="Label8" runat="server" Text="Status Code"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="StatusCodeDropDownList" runat="server" AppendDataBoundItems="True"
                    DataSourceID="StatusCodeLinqDataSource" DataTextField="Code" DataValueField="StatusCodeId"
                    Width="100%">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style10" align="right">
                <asp:Label ID="Label4" runat="server" Text="Content"></asp:Label>
            </td>
            <td class="style9">
                <asp:DropDownList ID="ContentTypeDropDownList" runat="server" DataSourceID="ContentTypeLinqDataSource"
                    DataTextField="ContentName" DataValueField="ContentTypeId" AppendDataBoundItems="True"
                    Width="100%">
                </asp:DropDownList>
            </td>
            <td align="right" class="style5">
                &nbsp;
            </td>
            <td>
                <table width="100%">
                    <tr>
                        <td class="style11">
                            <asp:CheckBox ID="chkUseIcons" runat="server" Text="Use Icons" />
                        </td>
                        <td class="style12">
                            <asp:CheckBox ID="chkUseTag" runat="server" Text="Use Tags" />
                        </td>
                        <td>
                            <asp:CheckBox ID="chkUseReCaptcha" runat="server" Text="Use ReCaptcha" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="style10" align="right">
                <asp:Label ID="Label5" runat="server" Text="Language"></asp:Label>
            </td>
            <td class="style9">
                <asp:DropDownList ID="LanguageDropDownList" runat="server" AppendDataBoundItems="True"
                    DataSourceID="LanguageLinqDataSource" DataTextField="LanguageName" DataValueField="LanguageId"
                    Width="100%">
                </asp:DropDownList>
            </td>
            <td align="right" class="style5">
                &nbsp;
            </td>
            <td>
                <table width="100%">
                    <tr>
                        <td class="style11">
                            <asp:CheckBox ID="chkUseHideTag" runat="server" Text="Use Hide Tag" />
                        </td>
                        <td class="style8">
                            <asp:CheckBox ID="chkIsApproved" runat="server" Text="Is Approved" />
                        </td>
                        <td>
                            <asp:CheckBox ID="chkUsePrefix" runat="server" Text="Use Prefix" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="right" class="style10">
                <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" Text="Search"
                    Width="100%" />
            </td>
            <td class="style9">
                &nbsp;
            </td>
            <td align="right" class="style5">
                &nbsp;
            </td>
            <td>
                <table width="100%">
                    <tr>
                        <td class="style11">
                            <asp:CheckBox ID="chkIsHostContraint" runat="server" Text="Is Host Contraint" />
                        </td>
                        <td class="style8">
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Panel>
<%--<asp:Panel ID="panelFilterForum" runat="server">
    <UserControl:ucFilterForum ID="ucFilterForumControl" runat="server" />
</asp:Panel>--%>
<asp:Panel ID="pnlView" runat="server">
    <asp:Label ID="Label1" runat="server" Text="View Mode"></asp:Label>
    <asp:DropDownList ID="dropDownListViewContent" runat="server" OnSelectedIndexChanged="dropDownListViewContent_SelectedIndexChanged"
        AutoPostBack="True" Width="20%">
        <asp:ListItem>Forum Content</asp:ListItem>
        <asp:ListItem>Login Account</asp:ListItem>
        <asp:ListItem>Settings</asp:ListItem>
        <asp:ListItem>Messages</asp:ListItem>
    </asp:DropDownList>
    <asp:Label ID="Label12" runat="server" Text="Show forums per page"></asp:Label>
    <asp:DropDownList ID="dropDownListNumberOfRows" runat="server" AutoPostBack="True"
        OnSelectedIndexChanged="dropDownListNumberOfRows_SelectedIndexChanged">
        <asp:ListItem>10</asp:ListItem>
        <asp:ListItem>20</asp:ListItem>
        <asp:ListItem>50</asp:ListItem>
        <asp:ListItem>100</asp:ListItem>
        <asp:ListItem>All</asp:ListItem>
    </asp:DropDownList>
</asp:Panel>
<asp:UpdatePanel ID="GridViewForumsUpdatePanel" runat="server">
    <ContentTemplate>
        <asp:GridView ID="gridViewForums" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" DataKeyNames="ForumId" DataSourceID="ForumLinqDataSource"
            OnRowDataBound="gridViewForums_RowDataBound" BackColor="White" BorderColor="#999999"
            BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" Width="100%"
            OnSelectedIndexChanged="gridViewForums_SelectedIndexChanged">
            <AlternatingRowStyle BackColor="#DCDCDC" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
                <asp:TemplateField HeaderText="Select" ItemStyle-HorizontalAlign="Center">
                    <HeaderTemplate>
                        <asp:CheckBox ID="chkHead" runat="server" onclick="changeCheckState(this);" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkCheckItem" runat="server" OnCheckedChanged="chkCheckItem_CheckedChanged" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="#" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="lblNum" runat="server" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Url" SortExpression="ForumUrl">
                    <ItemTemplate>
                        <asp:HyperLink ID="hyperLinkUrl" NavigateUrl='<%#Eval("ForumUrl") + "/" + Eval("DefaultUrl")%>'
                            runat="server" Text='<%#Eval("ForumUrl")%>'></asp:HyperLink>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtUrl" runat="server" Text='<%#Bind("ForumUrl")%>' Width="100%"></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Type" SortExpression="ForumType.TypeName">
                    <ItemTemplate>
                        <asp:Label ID="lblForumType" runat="server" Text='<%#Eval("ForumType.TypeName")%>'></asp:Label>
                        <asp:Label ID="lblVersion" runat="server" Text='<%#Eval("Version")%>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="ForumTypeDropDownList" runat="server" DataSourceID="ForumTypeLinqDataSource"
                            DataTextField="TypeName" DataValueField="ForumTypeId" SelectedValue='<%#Bind("ForumTypeId") %>'>
                        </asp:DropDownList>
                        <asp:TextBox ID="txtVersion" runat="server" Text='<%#Bind("Version")%>'></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Content" SortExpression="ContentType.ContentName">
                    <ItemTemplate>
                        <asp:Label ID="lblContentType" runat="server" Text='<%#Eval("ContentType.ContentName") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="ContentTypeDropDownList" runat="server" DataSourceID="ContentTypeLinqDataSource"
                            DataTextField="ContentName" DataValueField="ContentTypeId" SelectedValue='<%#Bind("ContentTypeId") %>'>
                        </asp:DropDownList>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Language" SortExpression="Language.LanguageName">
                    <ItemTemplate>
                        <asp:Label ID="lblLanguage" runat="server" Text='<%#Eval("Language.LanguageName")%>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="LanguageDropDownList" runat="server" DataSourceID="LanguageLinqDataSource"
                            DataTextField="LanguageName" DataValueField="LanguageId" SelectedValue='<%#Bind("LanguageId") %>'>
                        </asp:DropDownList>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Location" SortExpression="Location.LocationName">
                    <ItemTemplate>
                        <asp:Image ID="imgFlag" ImageUrl='<%#Eval("Location.FlagUrl")%>' runat="server" />
                        <asp:Label ID="lblLocationName" runat="server" Text='<%#Eval("Location.LocationName")%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="AlexaRank" HeaderText="Rank" SortExpression="AlexaRank"
                    ReadOnly="true">
                    <ItemStyle HorizontalAlign="Right" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="DefaultUrl" SortExpression="DefaultUrl">
                    <ItemTemplate>
                        <asp:Label ID="lblDefaultUrl" runat="server" Text='<%#Eval("DefaultUrl")%>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtDefaultUrl" runat="server" Text='<%#Bind("DefaultUrl") %>' Width="100%"></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                <%--<asp:TemplateField HeaderText="Account" SortExpression="Account.UserName">
                    <ItemTemplate>
                        <asp:Label ID="lblAccount" runat="server" Text='<%#Eval("Account.UserName") %>'></asp:Label> &nbsp
                        <asp:Image ID="imgLoginStatus_True" Visible='<%# (bool)Eval("LoginStatus") == true %>' 
                            ImageUrl='~/Images/agt_action_success.png'  runat="server" Height="16px" 
                            Width="16px"/>
                        <asp:Image ID="imgLoginStatus_False" Visible='<%# (bool)Eval("LoginStatus") == false %>' 
                            ImageUrl='~/Images/agt_action_fail.png'  runat="server" Height="16px" 
                            Width="16px"/> 
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="dropDownListAccount" runat="server" 
                            DataSourceID="AccountLinqDataSource" DataTextField="UserName" 
                            DataValueField="AccountId" SelectedValue='<%#Bind("AccountId") %>'>
                        </asp:DropDownList>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="LoginDate" HeaderText="LoginDate" 
                    SortExpression="LoginDate" />--%>
                <asp:BoundField DataField="UserId" HeaderText="UserId" ItemStyle-HorizontalAlign="Right"
                    SortExpression="UserId">
                    <ItemStyle HorizontalAlign="Right" />
                </asp:BoundField>
                <asp:CheckBoxField DataField="IsTags" HeaderText="Tags" SortExpression="IsTags" />
                <asp:CheckBoxField DataField="IsIcons" HeaderText="Icons" SortExpression="IsIcons" />
                <asp:CheckBoxField DataField="IsHideTag" HeaderText="HideTag" SortExpression="IsHideTags" />
                <asp:CheckBoxField DataField="IsPrefix" HeaderText="Prefix" SortExpression="IsPrefix" />
                <asp:CheckBoxField DataField="IsReCaptcha" HeaderText="ReCaptcha" SortExpression="IsReCaptcha" />
                <asp:CheckBoxField DataField="IsAllowSearch" HeaderText="AllowSearch" SortExpression="IsAllowSearch" />
                <asp:TemplateField HeaderText="Group" SortExpression="ForumGroup.GroupName">
                    <ItemTemplate>
                        <asp:Label ID="lblGroup" runat="server" Text='<%# Eval("ForumGroup.GroupName") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="StatusCode" SortExpression="StatusCode.Code">
                    <ItemTemplate>
                        <asp:Label ID="lblStatusCode" runat="server" Text='<%# Eval("StatusCode.Code") + "-" + Eval("StatusCode.Name")%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Approved" SortExpression="IsApproved">
                    <ItemTemplate>
                        <asp:CheckBox ID="chkIsApproved" runat="server" Checked='<%#Bind("IsApproved")%>'
                            Enabled="false"></asp:CheckBox>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:CheckBox ID="chkIsApproved" runat="server" Checked='<%#Bind("IsApproved")%>'
                            Enabled="true"></asp:CheckBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:CheckBoxField DataField="IsHostContraint" HeaderText="HostContraint" SortExpression="IsHostContraint" />
                <asp:BoundField DataField="ErrorReport" HeaderText="Error Report" SortExpression="ErrorReport" />
                <asp:BoundField DataField="Notes" HeaderText="Notes" SortExpression="Notes" />
            </Columns>
            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
            <PagerSettings Mode="NumericFirstLast" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
            <SelectedRowStyle BackColor="White" Font-Bold="True" ForeColor="Blue" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#0000A9" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#000065" />
        </asp:GridView>
        <asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
        <ajaxToolkit:ModalPopupExtender ID="mdlPopup" runat="server" PopupControlID="PanelAddForums"
            TargetControlID="btnShowPopup" BackgroundCssClass="BackgroundStyle">
        </ajaxToolkit:ModalPopupExtender>
        <asp:Panel ID="PanelAddForums" runat="server" BackColor="#ffffff" BorderColor="#dadada"
            BorderStyle="Solid" BorderWidth="4px" Height="400px" Width="800px" Font-Names="Arial"
            Font-Size="10pt">
            <table cellpadding="10" cellspacing="0" style="width: 100%">
                <tr>
                    <td>
                        <asp:TextBox ID="txtForumList" runat="server" Rows="20" Width="100%" TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="center" valign="middle">
                        <asp:Button ID="btnAdd" runat="server" Text="Add Forums" OnClick="btnAdd_Click" />
                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" /><br />
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </ContentTemplate>
</asp:UpdatePanel>
<asp:LinqDataSource ID="ForumLinqDataSource" runat="server" ContextTypeName="WCrawlerLib.LinqDataClassesDataContext"
    EntityTypeName="" TableName="Forums" EnableDelete="True" EnableInsert="True"
    OnSelecting="ForumLinqDataSource_Selecting" EnableUpdate="True">
</asp:LinqDataSource>
<asp:LinqDataSource ID="LocationLinqDataSource" runat="server" ContextTypeName="WCrawlerLib.LinqDataClassesDataContext"
    EntityTypeName="" TableName="Locations">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ForumTypeLinqDataSource" runat="server" ContextTypeName="WCrawlerLib.LinqDataClassesDataContext"
    EntityTypeName="" TableName="ForumTypes">
</asp:LinqDataSource>
<asp:LinqDataSource ID="ContentTypeLinqDataSource" runat="server" ContextTypeName="WCrawlerLib.LinqDataClassesDataContext"
    EntityTypeName="" TableName="ContentTypes" EnableUpdate="True">
</asp:LinqDataSource>
<asp:LinqDataSource ID="LanguageLinqDataSource" runat="server" ContextTypeName="WCrawlerLib.LinqDataClassesDataContext"
    EntityTypeName="" TableName="Languages" OrderBy="LanguageName">
</asp:LinqDataSource>
<asp:LinqDataSource ID="GroupLinqDataSource" runat="server" ContextTypeName="WCrawlerLib.LinqDataClassesDataContext"
    EntityTypeName="" TableName="ForumGroups">
</asp:LinqDataSource>
<asp:LinqDataSource ID="StatusCodeLinqDataSource" runat="server" ContextTypeName="WCrawlerLib.LinqDataClassesDataContext"
    EntityTypeName="" TableName="StatusCodes">
</asp:LinqDataSource>
<asp:LinqDataSource ID="AccountLinqDataSource" runat="server" ContextTypeName="WCrawlerLib.LinqDataClassesDataContext"
    EntityTypeName="" TableName="Accounts">
</asp:LinqDataSource>
